FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9

LABEL author="Boll.lai"
LABEL email="boll.lai@welab-inc.com"
LABEL Remarks="ops-be comprise api interface | celery crontab task and asynchronous task"

COPY docker/punkt.tar.gz /tmp

COPY aliyun-sources.list /etc/apt/sources.list 
RUN echo "=>ubuntu apk source Switch aliCloud" \
    && apt-get update

RUN echo "=> system install dependencies pkg" \
    && apt-get install -y python3-dev gcc g++ gfortran musl-dev musl libffi-dev \
    && echo "=> system install tools pkg" \
    && apt-get install -y lrzsz jq curl net-tools procps bash vim default-mysql-client redis netcat-openbsd \
    && echo "=> Python pip source Switch aliCloud" \
    && python -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple \
    && python -m pip config set global.trusted-host pypi.tuna.tsinghua.edu.cn \
    && python -m pip install --upgrade pip \
    \
    && echo "=> Install dependent packages" \
    && pip install --no-cache-dir python-multipart==0.0.5 \
    && pip install --no-cache-dir pydantic[email] \
    && pip install --no-cache-dir uvicorn==0.17.6 \
    && pip install --no-cache-dir elasticsearch==7.16.3 \
    && pip install --no-cache-dir elasticsearch-dsl==7.4.0 \
    && pip install --no-cache-dir celery[redis]==5.2.3 \
    && pip install --no-cache-dir PyMySQL==1.0.2 \
    && pip install --no-cache-dir SQLAlchemy==1.4.32 \
    && pip install --no-cache-dir kubernetes \
    && pip install --no-cache-dir alembic==1.7.7 \
    && pip install --no-cache-dir orjson==3.6.7 \
    && pip install --no-cache-dir passlib==1.7.4 \
    && pip install --no-cache-dir python-jose==3.3.0 \
    && pip install --no-cache-dir loguru==0.6.0 \
    && pip install --no-cache-dir requests==2.27.1 \
    && pip install --no-cache-dir yagmail==0.15.277 \
    && pip install --no-cache-dir sh==1.14.2 \
    && pip install --no-cache-dir pandas==1.4.1 \
    && pip install --no-cache-dir python-dotenv==0.20.0 \
    && pip install --no-cache-dir nltk==3.7 \
    && pip install --no-cache-dir flower==1.2.0 \
    && pip install --no-cache-dir cm-client==45.0.4 \
    && pip install --no-cache-dir beautifulsoup4==4.11.1 \
    && pip install --no-cache-dir lxml==4.8.0 \
    && pip install --no-cache-dir pyhdfs==0.3.1 \
    && pip install --no-cache-dir jinja2==3.0.1 \
    && pip install --no-cache-dir aliyun-python-sdk-bssopenapi==2.0.3 \
    && pip install --no-cache-dir aliyun-python-sdk-core==2.13.36 \
    && pip install --no-cache-dir aliyun-python-sdk-ecs==4.24.26 \
    && pip install --no-cache-dir alibabacloud-tea==0.2.4 \
    && pip install --no-cache-dir alibabacloud-ims20190815==3.0.0 \
    && pip install --no-cache-dir ldap3==2.9.1 \
    && pip install --no-cache-dir huaweicloudsdkbss==3.1.26 \
    && pip install --no-cache-dir huaweicloudsdkcore==3.1.26 \
    && pip install --no-cache-dir --upgrade chinese-calendar \
    && pip install --no-cache-dir nltk==3.7 \
    && pip install --no-cache-dir chardet==4.0.0 \
    && pip install --no-cache-dir openpyxl \
    && pip install --no-cache-dir pydoris==1.0.5.3 \
    \
    && echo "=> copy nltk tools package" \
    && mkdir -p /root/nltk_data/tokenizers \
    && tar xvf /tmp/punkt.tar.gz -C /root/nltk_data/tokenizers

COPY . /app
